<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script>
        var str='aaa abc reg';
        var re=/a/g;
        alert(str.replace(re,0));//这种方法，只能替换一个，需要跟正则表达式配合
    </script>
</head>
<body>

</body>
</html>